package codingforgreat.lchot150;

import java.util.Arrays;

public class Lc179 {
    public String largestNumber(int[] nums) {
        int n = nums.length;
        String[] s = new String[n];
        for(int i = 0;i < n;i++){
            s[i] = String.valueOf(nums[i]);
        }
        Arrays.sort(s,(a, b) -> (b + a).compareTo(a + b));
        StringBuilder sb = new StringBuilder();
        for(int i = 0;i < n;i++){
            sb.append(s[i]);
        }
        return sb.toString().startsWith("0") ? "0" : sb.toString() ;
    }
}
